Skip to content

Resolved issue with FlashOfUnstyledContent (FOUC) when using jQuery Mobile - #233

Merged
Mottie merged 1 commit into
Mottie:masterfrom
BrandonLWhite:master
Feb 8, 2014
Merged

Resolved issue with FlashOfUnstyledContent (FOUC) when using jQuery Mobile#233
Mottie merged 1 commit into
Mottie:masterfrom
BrandonLWhite:master

Conversation

@BrandonLWhite

Copy link
Copy Markdown
Contributor

There is a 10ms delay after the keyboard is displayed before it actually fires 'visible.keyboard'.
Since the jQuery Mobile plugin restyles the controls in response to the 'visible.keyboard' event, the user will experience FlashOfUnstyledContent (FOUC). I guess technically it's not unstyled -- just the wrong style.

This fix, or workaround rather, avoids this FOUC by first setting the visibility to hidden on 'beforeVisible.keyboard' so that the user doesn't see anything during the delay, then after the mobile styles are applied we set it visible.

This may not be ideal -- but I couldn't think of a better way to approach this without purposely eliminating the setTimeout delay in the core code or by adding another event before the setTimeout.

You don't see the issue in the demo page for jQM, because its not showing keyboards in response to touches/clicks. If you'd prefer to see some test cases, I can put together some fiddles later.

Also, I didn't get a chance to do the minified version. I'm expecting to do another PR, hopefully by Monday.

@Mottie

Mottie commented Feb 8, 2014

Copy link
Copy Markdown
Owner

Thanks @BrandonLWhite!

I haven't done much testing on mobile since I have a very old android smart phone (v2.3.5) which I don't use the internet on LOL. So thanks for taking the time to help improve this project!

Rob

Mottie added a commit that referenced this pull request Feb 8, 2014
Resolved issue with FlashOfUnstyledContent (FOUC) when using jQuery Mobile
@Mottie
Mottie merged commit 06eb203 into Mottie:master Feb 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants